using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class scheduleMap : EntityTypeConfiguration<schedule>
    {
        public scheduleMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.time)
                .IsFixedLength()
                .HasMaxLength(8);

            this.Property(t => t.pat_name)
                .IsFixedLength()
                .HasMaxLength(72);

            this.Property(t => t.mobile)
                .IsFixedLength()
                .HasMaxLength(20);

            this.Property(t => t.casenum)
                .IsFixedLength()
                .HasMaxLength(12);

            this.Property(t => t.telephone)
                .IsFixedLength()
                .HasMaxLength(20);

            this.Property(t => t.time1)
                .IsFixedLength()
                .HasMaxLength(8)
                .IsRowVersion();

            this.Property(t => t.Code)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("schedule");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.date).HasColumnName("date");
            this.Property(t => t.time).HasColumnName("time");
            this.Property(t => t.duration).HasColumnName("duration");
            this.Property(t => t.room).HasColumnName("room");
            this.Property(t => t.comment).HasColumnName("comment");
            this.Property(t => t.proc_class).HasColumnName("proc_class");
            this.Property(t => t.pat_id).HasColumnName("pat_id");
            this.Property(t => t.pat_name).HasColumnName("pat_name");
            this.Property(t => t.doc_id).HasColumnName("doc_id");
            this.Property(t => t.period).HasColumnName("period");
            this.Property(t => t.mobile).HasColumnName("mobile");
            this.Property(t => t.status).HasColumnName("status");
            this.Property(t => t.casenum).HasColumnName("casenum");
            this.Property(t => t.vac_id).HasColumnName("vac_id");
            this.Property(t => t.recall).HasColumnName("recall");
            this.Property(t => t.unreason).HasColumnName("unreason");
            this.Property(t => t.missed).HasColumnName("missed");
            this.Property(t => t.telephone).HasColumnName("telephone");
            this.Property(t => t.time1).HasColumnName("time1");
            this.Property(t => t.bdate).HasColumnName("bdate");
            this.Property(t => t.UserId).HasColumnName("UserId");
            this.Property(t => t.vip).HasColumnName("vip");
            this.Property(t => t.MasterApp).HasColumnName("MasterApp");
            this.Property(t => t.UserID_DEL_CAN).HasColumnName("UserID_DEL_CAN");
            this.Property(t => t.TPI).HasColumnName("TPI");
            this.Property(t => t.Code).HasColumnName("Code");
        }
    }
}
